using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SlimeGroundState : EnemyState
{
    protected Enemy_Slime enemy;
    private Transform player;
    public SlimeGroundState(Enemy enemyBase, EnemyStateMachine enemyStateMachine, string animatorName,Enemy_Slime enemy) : base(enemyBase, enemyStateMachine, animatorName)
    {
        this.enemy = enemy;
    }
    public override void Enter()
    {
        player = PlayerManager.Instance.player.transform;
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        if (enemy.PlayerDetected() || Vector2.Distance(player.position, enemy.transform.position) < 2)
            enemy.enemyStateMachine.ChangeState(enemy.slimeBattleState);
    }
}
